﻿using System;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000014 RID: 20
	[Serializable]
	public class Constraints
	{
		// Token: 0x0600014B RID: 331 RVA: 0x00002F7A File Offset: 0x0000117A
		public bool IsValid()
		{
			return this.transform != null;
		}

		// Token: 0x0600014C RID: 332 RVA: 0x00002F88 File Offset: 0x00001188
		public void Initiate(Transform transform)
		{
			this.transform = transform;
			this.position = transform.position;
			this.rotation = transform.eulerAngles;
		}

		// Token: 0x0600014D RID: 333 RVA: 0x0001EC54 File Offset: 0x0001CE54
		public void Update()
		{
			if (!this.IsValid())
			{
				return;
			}
			this.transform.position += this.positionOffset;
			if (this.positionWeight > 0f)
			{
				this.transform.position = Vector3.Lerp(this.transform.position, this.position, this.positionWeight);
			}
			this.transform.rotation = Quaternion.Euler(this.rotationOffset) * this.transform.rotation;
			if (this.rotationWeight > 0f)
			{
				this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.Euler(this.rotation), this.rotationWeight);
			}
		}

		// Token: 0x04000093 RID: 147
		public Transform transform;

		// Token: 0x04000094 RID: 148
		public Vector3 positionOffset;

		// Token: 0x04000095 RID: 149
		public Vector3 position;

		// Token: 0x04000096 RID: 150
		[Range(0f, 1f)]
		public float positionWeight;

		// Token: 0x04000097 RID: 151
		public Vector3 rotationOffset;

		// Token: 0x04000098 RID: 152
		public Vector3 rotation;

		// Token: 0x04000099 RID: 153
		[Range(0f, 1f)]
		public float rotationWeight;
	}
}
